package org.quipu.domain;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name = "TRANSACTION_TAG")
@NamedQueries({
    @NamedQuery(name = "TransactionTagMap.findAll", query = "SELECT tt FROM TransactionTagMap tt"),
    @NamedQuery(name = "TransactionTagMap.findById", query = "SELECT tt FROM TransactionTagMap tt WHERE tt.id=:id"),
    @NamedQuery(name = "TransactionTagMap.findByMapping", query = "SELECT tt FROM TransactionTagMap tt WHERE tt.transaction.id=:trId AND tt.tag.id=:tagId")
})
public class TransactionTagMap extends UniqueEntity implements Serializable {

    @JoinColumn(name = "ID_TRANSACTION", referencedColumnName = "ID")
    @ManyToOne
    private Transaction transaction;

    @JoinColumn(name = "ID_TAG", referencedColumnName = "ID")
    @ManyToOne
    private Tag tag;

    public Tag getTag() {
        return tag;
    }

    public void setTag(Tag tag) {
        this.tag = tag;
    }

    public Transaction getTransaction() {
        return transaction;
    }

    public void setTransaction(Transaction transaction) {
        this.transaction = transaction;
    }
}
